package com.edu.html.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.edu.common.controller.BaseController;
import com.edu.common.model.PageQuery;
import com.edu.common.model.Response;
import com.edu.html.pojo.Books;
import com.edu.html.service.BookService;

@Controller
@RequestMapping("/html/")
public class indexController extends BaseController{
	
	@Autowired
	private BookService bookService;
	
	@RequestMapping("{index}.shtml")
	public String index(HttpServletRequest request,@PathVariable("index") String index,Model model){
		return index;
	}
	
	@RequestMapping("queryList.shtml")
	@ResponseBody
	public Response<PageQuery<Books>> queryList(@RequestBody Books book){
		Response<PageQuery<Books>> response = new Response<PageQuery<Books>>();
		PageQuery<Books> pageQuery = bookService.queryList(book);
		response.setCode(200);
		response.setSuccess(SUCCESS);
		response.setMessage("请求成功");
		response.setResult(pageQuery);
		return response;
	}

}
